﻿#region File Description
//-----------------------------------------------------------------------------
// VertexPositionNormal.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion

#region Using Statements
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
#endregion

namespace TerrainGenerator.Geometry
{
    /// <summary>
    /// Custom vertex type for vertices that have just a
    /// position, normal and color
    /// </summary>
    public struct VertexPositionNormalColored
    {
        public Vector3 Position;
        public Vector3 Normal;
        public Color Color;


        /// <summary>
        /// Constructor.
        /// </summary>
        public VertexPositionNormalColored(Vector3 position, Vector3 normal, Color color)
        {
            this.Position = position;
            this.Normal = normal;
            this.Color = color;
        }


        /// <summary>
        /// Vertex format information, used to create a VertexDeclaration.
        /// </summary>
        public static VertexElement[] VertexElements = new VertexElement[]
              {
                  new VertexElement( 0, 0, VertexElementFormat.Vector3, VertexElementMethod.Default, VertexElementUsage.Position, 0 ),
                  new VertexElement( 0, sizeof(float) * 3, VertexElementFormat.Vector3, VertexElementMethod.Default, VertexElementUsage.Normal, 0 ),
                  new VertexElement( 0, sizeof(float) * 6, VertexElementFormat.Color, VertexElementMethod.Default, VertexElementUsage.Color, 0 )
              };


        /// <summary>
        /// Size of this vertex type.
        /// </summary>
        public const int SizeInBytes = sizeof(float) * 7;
    }
}
